<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-5-30
 * Time: 下午11:43
 */
class Mapplyinterview extends CI_Model{
    function __construct(){
        parent::__construct();
    }

    /**
     * 写入微访谈申请
     * @param $uid
     * @param $phone
     * @param $weixin
     * @return mixed
     */
    function insertApply($uid,$realname,$weixin)
    {
        $data = array(
            'uid' => $uid ,
            'realname' => $realname ,
            'weixin' => $weixin
        );

        $this->db->insert('apply_interview', $data);
        return $this->db->insert_id();
    }

    /**
     * 检测是否已申请
     * @param $uid
     * @return bool
     */
    function checkApply($uid)
    {
        $query = $this->db->get_where('apply_interview', array('uid' => $uid), 1);
        $exists = true;
        if ($query->num_rows() > 0)
        {
            $exists = false;
        }
        return $exists;
    }
}